<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // let person1 = new Person('cuifan', 18)
    // console.log(Object.getOwnPropertyDescriptors(person1));
    // console.log(person1.__proto__); // 对象的原型 => Person构造函数的原型对象，
    // // 创建一个构造函数，就会创建一个它的原型对象，由构造函数的prototype指向
    // console.log(Person.prototype);
    // console.log(Person.prototype.constructor === Person);
    // console.log(Person.prototype.__proto__ === Object.prototype); // 原型对象的原型是对象的原型对象

    // console.log(Person.prototype.isPrototypeOf(person1));
    // console.log(Object.getPrototypeOf(person1) === Person.prototype); // 拿到原型
    // console.log(Person.prototype.isPrototypeOf(person1));
    // console.log(Object.getPrototypeOf(person1) === Person.prototype);

    // let person2 = {
    //   name: 'cuifan',
    //   height: 180
    // }

    // Object.setPrototypeOf(person1, person2)
    // console.log(Object.getPrototypeOf(person1) === person2);

    // let person2 = {
    //   name: 'cufianfan'
    // }

    // let person3 = Object.create(person2)
    // person3.age = 20
    // console.log(person3.age);
    // console.log(person3.name);

    // Person.prototype.cuifan = '崔帆'
    // let person2 = new Person()
    // let person3 = new Person('erqi')
    // person2.cuifan = '999'

    // // delete person2.cuifan
    // // console.log(person2.cuifan);
    // // console.log(person3.cuifan);
    // console.log(person2.hasOwnProperty('cuifan'));
    // console.log(person3.hasOwnProperty('cuifan'));

    // let person1 = {
    //   year: 2021,
    //   age: 100
    // }
    // let person2 = Object.create(person1)
    // person2.name = 'cuifan',
    //   person2.sex = '男'
    // person2.age = 20
    // for (let i in person2) {
    //   console.log(person2[i]);
    // }
    // Object.defineProperty(person2, "name", {
    //   value: 'cuifan',
    //   configurable: false,
    //   enumerable: false
    // })

    // // person2[Symbol.iterator] = 'dddd'
    // let s1 = Symbol('s1')
    // person2[s1] = 'dddd'
    // console.log(Object.keys(person2));
    // console.log(Object.getOwnPropertyNames(person2));
    // console.log(Object.getOwnPropertySymbols(person2));

    //   let person1 = {
    //     age: 20,
    //     year: 2001
    //   }
    //   Object.defineProperty(person1, "name", {
    //     value: 'cufian',
    //     enumerable: false
    //   })
    //   Object.defineProperty(Object.prototype, 'dead', {
    //     value: 2100,
    //     enumerable: true
    //   })
    //   let person2 = {
    //     height: 180
    //   }
    //   for (let i in person1) {
    //     console.log(i);
    //     // console.log(person1[i]);
    //   }
    //   console.log(Object.getOwnPropertyNames(person1));
    //   console.log(Object.keys(person1));
    //   let person3 = Object.assign(person2, person1)
    //   console.log(person3);
    // function Person(name, age) {
    //   this.name = name
    //   this.age = age
    // }
    // let obj1 = Object.getPrototypeOf(Person) // 函数的原型
    // console.log(obj1);
    // console.log(Object.getPrototypeOf(obj1) === Object.prototype);
    // let obj2 = Object.getPrototypeOf(Array) // 数组构造函数的原型
    // console.log(obj2);
    // console.log(obj1 === obj2);
    // console.log(obj1 == obj2);
    // console.log(Object.getPrototypeOf(obj2) === Object.prototype);
    // let obj = {}
    // let obj1 = {
    //   name: 'cuifan',
    //   prototype: obj
    // }
    // let obj2 = Object.create(obj)
    // console.log(obj2 instanceof obj1);
  </script>
</body>

</html>